package com.basic.business.log.domain;

import com.basic.business.common.utils.ULIDUtils;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;

/**
 * 订单日志表 t_orders_log
 *
 * @author zhaoxy_jn@163.com
 */
@Getter
@Setter
public class TOrdersLog implements Serializable {

    private static final long serialVersionUID = 1L;

    private String id;

    /** 主系统订单号 */
    private long mainSid;

    /** 系统订单号 */
    private long logSid;

    /** 日志内容 */
    private String content;

    /** 自动处理文件路径 */
    private String filePath;

    /** 文件状态 1成功 2删除*/
    private String fileStatus;

    /** 操作用户id */
    private long userId;

    /** 数据创建时间 */
    private long created;

    public TOrdersLog(long mainSid, long sid, String content, long created) {
        this.id = ULIDUtils.getId();
        this.mainSid = mainSid;
        this.logSid = sid;
        this.content = content;
        this.userId = 1;
        // 0 表示系统自动生成
        this.created = created != 0 ? created : System.currentTimeMillis();
    }

    public TOrdersLog(long mainSid, long sid, String content, String filePath) {
        this.id = ULIDUtils.getId();
        this.mainSid = mainSid;
        this.logSid = sid;
        this.content = content;
        this.filePath = filePath;
        this.fileStatus = "0";
        this.userId = 1;
        // 0 表示系统自动生成
        this.created = System.currentTimeMillis();
    }

    public TOrdersLog(String id, String filePath, long created) {
        this.id = id;
        this.filePath = filePath;
        this.created = created;
    }

    public TOrdersLog(String id, String filePath) {
        this.id = id;
        this.filePath = filePath;
    }


    @Override
    public String toString() {
        return "TOrdersLog{" +
                "id='" + id + '\'' +
                ", mainSid=" + mainSid +
                ", logSid=" + logSid +
                ", content='" + content + '\'' +
                ", filePath='" + filePath + '\'' +
                ", fileStatus='" + fileStatus + '\'' +
                ", userId=" + userId +
                ", created=" + created +
                '}';
    }

}
